﻿using FreeSql.DataAnnotations;
using FreeSqlLearn;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace FreesqlLearn.Entity.Model
{
	/// <summary>
	/// 充值记录
	/// </summary>
    [JsonObject(MemberSerialization.OptIn), Table(DisableSyncStructure = false)]
    public class ChargeRecord
	{
		/// <summary>
		/// 雪花算法ID
		/// </summary>
		[Snowflake]
		[JsonProperty, Column(IsPrimary = true)]
		public long Id { get; set; }
		/// <summary>
		/// 学员账号ID
		/// </summary>
		[JsonProperty]
		public long StudentAccountId { get; set; }
		/// <summary>
		/// 版本号
		/// </summary>
		[JsonProperty, Column(IsVersion = true)]
		public int SysVersion { get; set; }
		/// <summary>
		/// 创建时间/充值时间
		/// </summary>
		[JsonProperty, Column(CanInsert = true, CanUpdate = false, ServerTime = DateTimeKind.Local)]
		public DateTime CreateTime { get; set; }

		/// <summary>
		/// 充值金额
		/// </summary>
		[JsonProperty, Column(CanUpdate = false)]
		public decimal Money { get; set; }
		/// <summary>
		/// 充值后 最新余额
		/// </summary>
		[JsonProperty, Column(CanUpdate = false)]
		public decimal BalanceOfThis { get; set; }

		/// <summary>
		/// 工作人员账号ID
		/// </summary>
		[JsonProperty]
		public long EmployeeAccountId { get; set; }

		//导航属性，ManyToOne/OneToOne
		[Navigate(nameof(EmployeeAccountId))]
		public virtual EmployeeAccount EmployeeAccountModel { get; set; }
	}
}
